function out = SaveMemory(P,is_running, action, timer)

% global memory variables
global actions;
global running;
global timers;

global actions_op;
global running_op;
global timers_op;

P_color = P{2};
P_num = P{3};

if (P_color == 'r')
    running(P_num) = is_running;
    actions(P_num) = action;
    timers(P_num) = timer;
else
    running_op(P_num) = is_running;
    actions_op(P_num) = action;
    timers_op(P_num) = timer;
end

out = 0;
end